package com.yu.waterstation.system.modules.app.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yu.waterstation.common.common.annotation.NeedPermission;
import com.yu.waterstation.common.common.exception.ServiceException;
import com.yu.waterstation.common.common.util.result.Result;
import com.yu.waterstation.common.entity.app.TaskLog;
import com.yu.waterstation.system.modules.app.service.impl.TaskLogServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * date 2020-12-02 18:16:20
 */
@Api(tags = "系统：送水日志管理")
@RestController
@RequestMapping("system/taskLog")
public class TaskLogController {

    @Resource
    private TaskLogServiceImpl taskLogService;

    @ApiOperation("分页条件查询")
    @NeedPermission("system:taskLog:list")
    @GetMapping("/search")
    public Result<Page<TaskLog>> searchTaskLogs(
            @ApiParam("起始时间") @RequestParam(defaultValue = "0") long startTime,
            @ApiParam("楼舍") @RequestParam(required = false) String dorm,
            @ApiParam("房间号") @RequestParam(required = false) String room,
            @ApiParam("送水员姓名") @RequestParam(required = false) String workerName,
            @RequestParam(defaultValue = "1") int pageNo,
            @RequestParam(defaultValue = "10") int pageSize)   {
        return Result.ok(taskLogService.searchTaskLogs(startTime, dorm, room, workerName, pageNo, pageSize));
    }
}
